﻿@model IEnumerable<Qcy.Jshj.Web.Models.CompanyInfo>
@{
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
<script src="/Scripts/xheditor/xheditor-1.1.14-zh-cn.min.js"></script>

<div id="tb" style="padding: 5px; height: auto">
    <div style="margin-bottom: 5px">
        @ViewBag.Title
        &nbsp; 
                <a href="javascript:void(0);" onclick="edit();" class="easyui-linkbutton" iconcls="icon-edit" plain="true">修改</a>
    </div>
</div>
<div id="tt" class="easyui-tabs" style="width: 800px; height: 400px;">
    @if (Model != null)
    {
        foreach (var item in Model)
        { 
        <input type="hidden" name="cname" value="@item.Id" />           
        <div title="@item.Name" style="padding: 10px">

            @Html.Raw(item.Content)

        </div>  
        }
    }
    <div style="clear: both;"></div>
</div>
<script type="text/javascript">
    $(function () {
        $("#tt").tabs();
        $('#articleform').form({
            success: function (data) {
                data = eval("(" + data + ")");
                $.messager.alert('提交结果', data.result, 'info', function () {
                    var index = getSelected();
                    var tab = $('#tt').tabs('getSelected');
                    tab.context.innerHTML = data.content;
                    $('#articlewindow').window('close');
                });
            }
        });
        $('#Content').xheditor({
            upLinkUrl: "../../Scripts/xheditor/upload.aspx",
            upLinkExt: "zip,rar,txt",
            upImgUrl: "../../Scripts/xheditor/upload.aspx",
            upImgExt: "jpg,jpeg,gif,png",
            upFlashUrl: "../../Scripts/xheditor/upload.aspx",
            upFlashExt: "swf",
            upMediaUrl: "../../Scripts/xheditor/upload.aspx",
            upMediaExt: "wmv,avi,wma,mp3,mid",
            localUrlTest: /^https?:\/\/[^\/]*?(xheditor\.com)\//i,
            remoteImgSaveUrl: 'saveremoteimg.aspx',
            //loadCSS: "../../Content/css/news.css"
        });
        $('#ContentEn').xheditor({
            upLinkUrl: "../../Scripts/xheditor/upload.aspx",
            upLinkExt: "zip,rar,txt",
            upImgUrl: "../../Scripts/xheditor/upload.aspx",
            upImgExt: "jpg,jpeg,gif,png",
            upFlashUrl: "../../Scripts/xheditor/upload.aspx",
            upFlashExt: "swf",
            upMediaUrl: "../../Scripts/xheditor/upload.aspx",
            upMediaExt: "wmv,avi,wma,mp3,mid",
            localUrlTest: /^https?:\/\/[^\/]*?(xheditor\.com)\//i,
            remoteImgSaveUrl: 'saveremoteimg.aspx',
            //loadCSS: "../../Content/css/news.css"
        });

    });
    function getSelected() {
        var tab = $('#tt').tabs('getSelected');
        var index = $('#tt').tabs('getTabIndex', tab);
        return index;
    }
    function openForm() {
        $('#articleform')[0].reset();
        $('#Id').val('0');
        $("#Content").val("");
        $('#articlewindow').window('open');
    }
    function edit() {
        var selected = getSelected();
        if (selected != undefined && selected != null) {
            openForm();
            $.get('/Admin/GetCompanyInfo/' + $("input[name=cname]").eq(selected).val(), function (data) {
                $('#articleform').form('load', data);
            });
        } else {
            alert('没有选择任何资料');
        }
    }
</script>
<div id="articlewindow" class="easyui-window" title="@ViewBag.Title" data-options="modal:true,closed:true,iconCls:'icon-save'" style="width: 700px; height: 500px; padding: 10px;">
    <form id="articleform" method="post" action="/Admin/CompanyInfo" enctype="multipart/form-data">
        <input type="hidden" name="Id" id="Id" />
        <table>
            <tr>
                <td class="flabel" style="width: 80px;">资料名称:</td>
                <td>
                    <input class="easyui-validatebox f600" type="text" name="Name" data-options="required:true" /></td>
            </tr>
            <tr>
                <td class="flabel">英文名称:</td>
                <td>
                    <input class="easyui-validatebox f600" type="text" name="NameEn" data-options="required:true" /></td>
            </tr>
            <tr>
                <td class="flabel">资料内容:</td>
                <td>
                    <textarea id="Content" name="Content" rows="4" style="height: 400px;" class="f600"></textarea></td>
            </tr>
            <tr>
                <td class="flabel">英文内容:</td>
                <td>
                    <textarea id="ContentEn" name="ContentEn" rows="4" style="height: 400px;" class="f600"></textarea></td>
            </tr>
            <tr>
                <td colspan="2" style="text-align: right;">
                    <hr />
                    <input type="submit" value="提交" /></td>
            </tr>
        </table>
    </form>
</div>
